# 多态  多个子类对应一个父类所产生不同的效果
#  object类是全部类的祖先
class Dog(object):
    def __init__(self,name):
        self.name=name

    def game(self):
        print("%s蹦蹦跳跳的玩耍..."%self.name)


class XiaoTianQuan(Dog):
    def game(self):
        print("%s飞到天上去玩耍"%self.name)


class Person(object):
    def __init__(self,name,):
        self.name=name

    def game_with_dog(self,dog):
        print("%s和%s快乐的玩耍..."%(self.name,dog.name))
        dog.game()


# 创建一个狗对象
# wangcai=Dog("旺财")
wangcai=XiaoTianQuan("飞天旺财")
# 创建一个小明
xiaoming=Person("小明")
# 让小明调用和狗玩的方法
xiaoming.game_with_dog(wangcai)

